import * as storage from './chromeSyncStorage'

class ChromeBaseStorage {
    protected key: string

    constructor(key: string) {
        this.key = key
    }

    get = () => {
        return storage.getLocalStorage(this.key)
    }

    set = (data) => {
        return storage.setLocalStorage({ [this.key]: data })
    }

    remove = () => {
        return storage.removeLocalStorage(this.key)
    }
}

// 存储侧边工具栏数据
export const ChromeSliderBarStorage = new ChromeBaseStorage(
    'CHROME_SLIDER_BAR_DATA',
)
// 存储chrome全局token数据
export const ChromeGlobalTokenStorage = new ChromeBaseStorage(
    'CHROME_GLOBAL_TOKEN',
)
